package com.chen.webservice.model;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

@Data
public class ConfigureParameterDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("日期")
    @NotBlank(message = "日期不允许为空")
    private String date;

    @ApiModelProperty("地标id")
    @NotBlank(message = "地标id不允许为空")
    private String landmarkId;

    @ApiModelProperty("开屏时间")
    @NotNull(message = "开屏时间不允许为空")
    private Integer openTime;

    @ApiModelProperty("关屏时间")
    @NotNull(message = "关屏时间不允许为空")
    private Integer closeTime;

    @ApiModelProperty("开屏视频id")
    private String startMaterialId;

    @ApiModelProperty("关屏视频id")
    private String endMaterialId;

    @ApiModelProperty("广告数据")
    @NotNull(message = "广告数据不允许为空")
    @Size(min = 1, message = "至少需要一条排单广告")
    private List<Order> orders;

    @ApiModelProperty("商业广告占比")
    private Double businessRate;

    @Valid
    @ApiModelProperty("安排固定节目")
    private FixProgram fixProgram;

    @ApiModelProperty("是否只排前30分钟广告")
    @NotNull(message = "请选择是否只排前30分钟广告")
    private Boolean onlyArrangeFirst30Minute;

    @Valid
    @ApiModelProperty("不允许相邻参数")
    private NotAdjacentProgram notAdjacentPrograme;

    @Valid
    @ApiModelProperty("整点或半点播放广告")
    private List<FixOrder> fixOrders;

    /**
     * 播放开始一分钟和结束前一分钟不安排常规节目，安排固定节目
     */
    @Data
    public static class FixProgram {

        @ApiModelProperty("是否安排固定节目")
        @NotNull(message = "ParameterEmptyError")
        private Boolean isArrage;

        @ApiModelProperty("播放时长")
        private Integer playTime;
    }

    @Data
    public static class NotAdjacentProgram {

        @ApiModelProperty("政府节目与商业节目是否允许相邻")
        @NotNull(message = "ParameterEmptyError")
        private Boolean governmentAndBusiness;

        @ApiModelProperty("同品类商业节目是否允许相邻")
        @NotNull(message = "ParameterEmptyError")
        private Boolean sameSubType;

        @ApiModelProperty("相同文字风格的节目是否允许相邻")
        @NotNull(message = "ParameterEmptyError")
        private Boolean sameWordType;

        @ApiModelProperty("相近色系节目是否允许相邻")
        @NotNull(message = "ParameterEmptyError")
        private Boolean sameColorType;
    }

    @Data
    public static class FixOrder {

        @NotNull(message = "整点/半点播放视频id不允许为空")
        @ApiModelProperty("整点/半点播放视频id")
        private Long id;

        @NotBlank(message = "视频名称不允许为空")
        @ApiModelProperty("视频名称")
        private String name;

        @NotNull(message = "播放起始时间不允许为空")
        @ApiModelProperty("播放起始时间，当前转为秒的时间")
        private Integer startTime;

        @NotNull(message = "广告播放时长不允许为空")
        @ApiModelProperty("广告播放时长")
        private Integer playTime;
    }
}
